#include "search.hpp"
#include <iostream>
const std::string raw_path = "data/raw_html/text.txt";

int main()
{
    //  int fd = open(log_path.c_str(), O_RDONLY | O_WRONLY | O_APPEND, 0660);
    //  if(fd < 0)
    //  {
    //     std::cout << "打开失败" << std::endl;
    //  }
    //  dup2(fd, 1);


    ns_search::Searcher* seracher = new ns_search::Searcher();
    seracher->InitSearcher(raw_path);

    std::string query;
    while(1)
    {
        std::cerr << "Please enter query#   ";
        std::getline(std::cin, query);

        std::string ret_json;
        seracher->search(query, ret_json);
        std::cout << ret_json << std::endl;
    }
    return 0;
}
